<div class="slide-dialog-header">
	<h2>{{title}}</h2>
	<div class="slide-dialog-toolbar">
		<ul>
			<li><span class="ui-btn slide-dialog-close" ng-click="close(false)"><i class="fa fa-remove"></i></span></li>
		</ul>
	</div>
</div>
<div class="slide-dialog-body">
	<div class="data-panel">
		<form name="form" novalidate="novalidate" ng-submit="submit(form.$valid);">
			<div class="data-panel-body">
				<div class="data-form">
					<table cellspacing="0" cellpadding="0">
						<colgroup>
							<col width="100" />
							<col />
							<col width="100" />
							<col />
							<col width="100" />
						</colgroup>
						<tbody>
							<tr>
								<td class="x-control"><span class="x-star">*</span>显示名称：</td>
								<td colspan="5">
									<input type="text" name="name" ng-model="data.name" class="x-ipt" required placeholder="请输入显示名称" />
									<div class="x-error" ng-if="interacted(form.name)" ng-messages="form.name.$error">
		                                <span ng-message="required">显示名称不能为空</span>
		                            </div>
								</td>
							</tr>
							<tr>
								<td class="x-control">控件模型：</td>
								<td colspan="5">
									<select name="formType" ng-model="data.formType" ng-options="m.value as m.name for m in formTypes" required><option value="">请选择控件模型</option></select>
									<div class="x-error" ng-if="interacted(form.formType)" ng-messages="form.formType.$error">
		                                <span ng-message="required">控件模型不能为空</span>
		                            </div>
								</td>
							</tr>
							<tr>
								<td class="x-control">是否必填：</td>
								<!-- <td><label><input type="radio" ng-model="data.required" class="x-radio" ng-value="1" /> 是</label> &nbsp; <label><input type="radio" ng-model="data.required" class="x-radio" ng-value="0" /> 否</label></td> -->
								<td><label data-toggle><input type="checkbox" ng-model="data.required" class="x-chk" ng-true-value="1" ng-false-value="0" /></label></td>
								<td class="x-control">是否显示：</td>
								<!-- <td><label><input type="radio" ng-model="data.hidden" class="x-radio" ng-value="1" /> 是</label> &nbsp; <label><input type="radio" ng-model="data.hidden" class="x-radio" ng-value="0" /> 否</label></td> -->
								<td><label data-toggle><input type="checkbox" ng-model="data.display" class="x-chk" ng-true-value="1" ng-false-value="0" /></label></td>
								<td class="x-control">是否只读：</td>
								<!-- <td><label><input type="radio" ng-model="data.readOnly" class="x-radio" ng-value="1" /> 是</label> &nbsp; <label><input type="radio" ng-model="data.readOnly" class="x-radio" ng-value="0" /> 否</label></td> -->
								<td><label data-toggle><input type="checkbox" ng-model="data.readOnly" class="x-chk" ng-true-value="1" ng-false-value="0" /></label></td>
							</tr>
							<tr>
								<td class="x-control">是否列表：</td>
								<td><label data-toggle><input type="checkbox" ng-model="data.exhibition" class="x-chk" ng-true-value="1" ng-false-value="0" /></label></td>
							</tr>
							<tr ng-if="data.formType=='SingleTextBox'||data.formType=='DropDownList'||data.formType=='RadioButtonList'||data.formType=='CheckBoxList'||data.formType=='DateTime'">
								<td class="x-control">是否检索：</td>
								<td><label data-toggle><input type="checkbox" ng-model="data.search" class="x-chk" ng-true-value="1" ng-false-value="0" /></label></td>
							</tr>
							<tr ng-if="data.formType=='SingleTextBox'||data.formType=='DropDownList'">
								<td class="x-control">控件长度：</td>
								<td colspan="5">
									<input type="text" name="controlsLength" ng-model="data.controlsLength" class="x-ipt" ng-pattern="/^[0-9_]+$/"/>
									<div class="x-error" ng-if="interacted(form.controlsLength)" ng-messages="form.controlsLength.$error">
		                    			<span ng-message="pattern">只能输入正整数</span>
		                    		</div>
								</td>
							</tr>
							<tr ng-if="data.formType=='MultiTextBox'">
								<td class="x-control">行：</td>
								<td colspan="5">
									<input type="text" name="rows" ng-model="data.rows" class="x-ipt" ng-pattern="/^[0-9_]+$/"/>
									<div class="x-error" ng-if="interacted(form.rows)" ng-messages="form.rows.$error">
		                    			<span ng-message="pattern">只能输入正整数</span>
		                    		</div>
								</td>
							</tr>
							<tr ng-if="data.formType=='MultiTextBox'">
								<td class="x-control">宽：</td>
								<td colspan="5">
									<input type="text" name="width" ng-model="data.width" class="x-ipt" ng-pattern="/^[0-9_]+$/"/>
									<div class="x-error" ng-if="interacted(form.width)" ng-messages="form.width.$error">
		                    			<span ng-message="pattern">只能输入正整数</span>
		                    		</div>
								</td>
							</tr>
							<tr>
								<td class="x-control">默认值：</td>
								<td colspan="5"><input type="text" ng-model="data.fieldDefault" class="x-ipt" placeholder="请输入默认值" /></td>
							</tr>
							<tr ng-if="data.formType=='RadioButtonList'||data.formType=='DropDownList'||data.formType=='CheckBoxList'">
								<td ng-if="data.optionType==1">选项列表：</td>
								<td ng-if="data.optionType==2" class="x-control">选项列表：</td>
								<td colspan="5">
									<label class="radio-group"><input type="radio" name="optionType" ng-model="data.optionType" value="1" />手工录入</label><label class="radio-group"><input type="radio" name="optionType" ng-model="data.optionType" value="2" />字典库选择</label>
									<div class="data-map" ng-if="data.optionType==1" style="margin-top:12px;">
										<dl ng-repeat="json in jsonArray() track by $index">
											<dt><input type="text" class="x-ipt" ng-model="json[getKey(1)]" placeholder="请输入选项名" required /></dt>
											<dd>
												<input type="text" class="x-ipt" ng-model="json[getKey(2)]" placeholder="请输入选项值" required />
												<span class="data-map-tools">
													<span class="ico-btn fa fa-minus-square" ng-click="removeJson($index)"></span>
													<span class="ico-btns" ng-if="$index != jsonArray().length - 1">
														<span class="ico-btn fa fa-caret-up" ng-if="$index != 0" ng-click="movePrev($index)"></span>
														<span class="ico-btn fa fa-caret-down" ng-click="moveNext($index)"></span>
													</span>
													<span class="ico-btn fa fa-plus-square" ng-if="$index == jsonArray().length - 1" ng-click="addJson()"></span>
												</span>
											</dd>
										</dl>
									</div>

									<span class="btn-tools" ng-if="data.optionType==2"><span class="btn-label" ng-click="selectOptions()">选择</span></span>
									<div class="data-field data-grid grid-fixed" ng-if="data.optionType==2 && data.optionResult">
										<div class="grid-footer" style="width:150px;">
											<table cellspacing="0" cellpadding="0" class="x-table">
												<thead>
												<tr>
													<th width="150"><div class="grid-inner">操作</div></th>
												</tr>
												</thead>
												<tbody>
												<tr>
													<td class="align-middle"><div class="grid-inner"><span class="btn-text" ng-click="preview(data.optionResult.id)">查看</span></div></td>
												</tr>
												</tbody>
											</table>
										</div>
										<div class="grid-body">
											<table cellspacing="0" cellpadding="0" class="x-table">
												<thead>
												<tr>
													<th width="150"><div class="grid-inner">字段名称</div></th>
													<th width="150"><div class="grid-inner">显示名称</div></th>
												</tr>
												</thead>
												<tbody>
												<tr>
													<td><div class="grid-inner">{{data.optionResult.field}}</div></td>
													<td><div class="grid-inner">{{data.optionResult.fieldName}}</div></td>
												</tr>
												</tbody>
											</table>
										</div>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
			<div class="data-panel-footer">
				<div class="data-tools">
					<button class="dialog-button cancel-button" type="button" ng-click="close(false)">取消</button><button class="dialog-button" type="submit">提交</button>
				</div>
			</div>
		</form>
	</div>
</div>